package com.yulan.fastkillcourse;


import com.yulan.fastkillcourse.model.Course;
import com.yulan.fastkillcourse.model.Student;
import com.yulan.fastkillcourse.mq.FastKillMessage;
import com.yulan.fastkillcourse.mq.MQReceiver;
import com.yulan.fastkillcourse.mq.MQSender;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Calendar;
import java.util.GregorianCalendar;

@SpringBootTest
public class testMQ {


    @Autowired
    MQSender mqSender;

    @Autowired
    MQReceiver mqReceiver;

    @Test
    public void test1(){


        Student student = Student.builder().
                uid(1)
                .build();

        GregorianCalendar startTime = new GregorianCalendar();
        startTime.set(2020, Calendar.MARCH, 31,23,0,0);

        GregorianCalendar endTime = new GregorianCalendar();
        endTime.set(2020, Calendar.APRIL, 2,0,0,0);

        Course course = Course.builder()
                .startTime(startTime.getTime())
                .endTime(endTime.getTime())
                .name("软件工程")
                .teacherName("朱凯")
                .kind(1)
                .introduction("软件工程噢！！！")
                .build();


        FastKillMessage fastKillMessage = new FastKillMessage(student.getUid(),course.getCid());

        mqSender.sendFastKillMessgae(fastKillMessage);
    }
}
